package com.ten.mall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.ten.mall.mapper.FenRuleMapper;
import com.ten.mall.service.FenRuleService;
import com.ten.mall.vo.FenRule;
import com.ten.mall.vo.FenRuleExample;
@Service
@Transactional
public class FenRuleServiceImpl implements FenRuleService{
	@Autowired
	private FenRuleMapper fenRuleMapper;
	@Override
	@Transactional(readOnly=true)
	public List<FenRule> selectByPages(Integer start, Integer size, String name) {
		PageHelper.startPage(start, size);
		FenRuleExample example =new FenRuleExample();
		List<FenRule> list =fenRuleMapper.selectByExample(example);
		return list;
	}

	@Override
	public int insertPrivilege(FenRule fenRule) {
		int i =fenRuleMapper.insert(fenRule);
		return i;
	}

	@Override
	public int updatePrivilege(FenRule fenRule) {
		int i =fenRuleMapper.updateByPrimaryKeySelective(fenRule);
		return i;
	}

	@Override
	public int deletePrivilege(Integer id) {
		int i =fenRuleMapper.deleteByPrimaryKey(id);
		return i;
	}

	@Override
	@Transactional(readOnly=true)
	public FenRule selectById(Integer id) {
		FenRule f =fenRuleMapper.selectByPrimaryKey(id);
		return f;
	}

}
